const pool = require("../connection/sqlPool");

async function DEBARK(login_name,password){    
    try{const promisePool = pool.promise();
        const [rows,fields] = await promisePool.execute(
            'SELECT * FROM `User` WHERE `user_name`=? AND `password`=?',
            [login_name,password]
        )
        console.log(rows)
        if(rows.length){
            return {status:299,msg:'登录成功',user_name:rows[0].user_name}
        }else{
            return {status:200,msg:'登录失败'}
        }
    
    }catch(e){
        return {status:400,msg:'未进行登录'}
    }    
}

module.exports = {DEBARK}